<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="/swiper/swiper-bundle.min.css">
    <script src="/swiper/swiper-bundle.min.js"></script>
    <style>
        .swiper {
            width: 600px;
            height: 300px;
        }

        .swiper-slide:nth-child(1) {
            background-color: red;
        }

        .swiper-slide:nth-child(2) {
            background-color: green;
        }

        .swiper-slide:nth-child(3) {
            background-color: blue;
        }

        .swiper-slide:nth-child(4) {
            background-color: pink;
        }

        .swiper-slide:nth-child(5) {
            background-color: hotpink;
        }
    </style>
</head>

<body>
    <div class="swiper swiper1">
        <div class="swiper-wrapper">
            <div class="swiper-slide">Slide 1</div>
            <div class="swiper-slide">Slide 2</div>
            <div class="swiper-slide">Slide 3</div>
            <div class="swiper-slide">Slide 4</div>
            <div class="swiper-slide">Slide 5</div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination swiper-pagination1"></div>

        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev swiper-button-prev1"></div>
        <div class="swiper-button-next swiper-button-next1"></div>
    </div>

    <div class="swiper swiper2">
        <div class="swiper-wrapper">
            <div class="swiper-slide">Slide 1</div>
            <div class="swiper-slide">Slide 2</div>
            <div class="swiper-slide">Slide 3</div>
           
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination swiper-pagination2"></div>

        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev swiper-button-prev2"></div>
        <div class="swiper-button-next swiper-button-next2"></div>
    </div>

    <script>

        //初始化第一个轮播图
        new Swiper(".swiper1", {
            direction: "horizontal",
            // autoplay: true,//自动播放
            autoplay: {
                delay: 1000,//一秒轮播一次
                stopOnLastSlide: true,//是否停留在最后一个滑块
                disableOnInteraction: true,//如果操作了当前的滑块，就会停止
            },
            // loop: true,//循环模式
            navigation: {//前后按钮的设置
                nextEl: '.swiper-button-next1',
                prevEl: '.swiper-button-prev1',
            },
            pagination: {//分页器的配置
                el: '.swiper-pagination1',
                clickable: true,
            },
            // slidesPerView:3,//同时显示3个滑块
            // effect: 'coverflow',//效果
        });

        //初始化第二个轮播图
        new Swiper(".swiper2", {
            direction: "vertical",
            // autoplay: true,//自动播放
            autoplay: {
                delay: 1000,//一秒轮播一次
                stopOnLastSlide: true,//是否停留在最后一个滑块
                disableOnInteraction: true,//如果操作了当前的滑块，就会停止
            },
            loop: true,//循环模式
            navigation: {//前后按钮的设置
                nextEl: '.swiper-button-next2',
                prevEl: '.swiper-button-prev2',
            },
            pagination: {//分页器的配置
                el: '.swiper-pagination2',
                clickable: true,
            },
            // slidesPerView:3,//同时显示3个滑块
            // effect: 'coverflow',//效果
        });
    </script>
</body>

</html>